]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Don't crash if app is missing categories
authorPhilip Chimento <philip@endlessm.com>
Fri, 25 Oct 2019 22:27:25 +0000 (15:27 -0700)
committerPhilip Chimento <philip@endlessm.com>
Fri, 25 Oct 2019 22:48:52 +0000 (15:48 -0700)
g_desktop_app_info_get_categories() may return null. In that case, the
previous code would fail to create a folder when dragging an app with
no categories onto another app. Instead, simply continue with the next
app info.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/782

js/ui/appDisplay.js

index 79c2f7e83afac0a77ba0283dc40cd8862416cdc7..68dbb7f871abbaf835d10ca3f37e7ad4103817f5 100644 (file)
@@ -98,7 +98,10 @@ function _findBestFolderName(apps) {
     let commonCategories = [];
 
     appInfos.reduce((categories, appInfo) => {
-        for (let category of appInfo.get_categories().split(';')) {
+        const appCategories = appInfo.get_categories();
+        if (!appCategories)
+            return categories;
+        for (let category of appCategories.split(';')) {
             if (!(category in categoryCounter))
                 categoryCounter[category] = 0;